"""
    Session controller.
"""

from mnemoply import model
from mnemoply.controllers.lookup import LookupController, TableCol, TableLookupDataSource
from mnemoply.controllers.crud import CRUDController

class SessionController(LookupController, CRUDController):
    model_object = model.Session
    lookup_columns = [
        TableCol(name='ordinal', caption=_('Seesion #')),
        TableCol(name='start_time', caption=_('Start time')),
        TableCol(name='end_time', caption=_('End time')),
        TableCol(name='classroom_type', caption=_('Classroom type'))
    ]
    view_fields = ['ordinal', 'startTime', 'endTime', 'classroomTypeID']

    def __init__(self):
        LookupController.__init__(self,
            data_source=TableLookupDataSource('session_lookup'),
            columns=self.lookup_columns,
            title=self.model_object.model_title,
        )
        CRUDController.__init__(self, model_object=self.model_object)

exposed = SessionController()
